<!DOCTYPE html>
<HTML>
<HEAD><meta name="viewport" content="width=device-width, initial-scale=1">
<Title>3D Scatter Chart (2)</Title>
<link type='text/css' rel='Stylesheet' href="maxchartapi.css" />
</HEAD>
<body bgcolor="#FFFFFF" text="#000000" topmargin="0" leftmargin="0" rightmargin="0" marginwidth="0" marginheight="0">

<p class="heading0">ChartDirector 7.0 (Java Edition)</p>
<p class="heading1">3D Scatter Chart (2)</p>
<hr class="separator">
<div class="content">
<img src="images/threedscatter2.png" width='720' height='520'>
<br><br>
This example extends the <a href="threedscatter.htm">3D Scatter Chart (1)</a> example by including drop lines, using alternative view angles and continuous coloring.<br><br>
Drop lines are lines that drop from the data points to the XY plane. They help to visualize the "height" (the z-coordinate) of the points and can be useful if there are not too many data points.<br><br>
<ul><li> The alternative view angles are set using <a href="ThreeDChart.setViewAngle.htm">ThreeDChart.setViewAngle</a>.<br><br>
<li> The drop lines are added using <a href="ThreeDScatterGroup.setDropLine.htm">ThreeDScatterGroup.setDropLine</a>.<br><br>
<li> Continuous coloring are configured using <a href="ColorAxis.setColorGradient.htm">ColorAxis.setColorGradient</a>.</ul>
</div>
<p class="heading1a">Source Code Listing</p>
<div class="content">
<b>[JSP Version]</b> jspdemo/threedscatter2.jsp
<div class='codeblock'><code class='pre'>&lt;%@page import="ChartDirector.*, java.util.*" %&gt;
&lt;%
// The XYZ data for the 3D scatter chart as 3 random data series
RanSeries r = new RanSeries(3);
double[] xData = r.getSeries2(20, 100, -10, 10);
double[] yData = r.getSeries2(20, 100, -10, 10);
double[] zData = r.getSeries2(20, 100, -10, 10);

// Create a ThreeDScatterChart object of size 720 x 520 pixels
ThreeDScatterChart c = new ThreeDScatterChart(720, 520);

// Add a title to the chart using 20 points Times New Roman Italic font
c.addTitle("3D Scatter Chart (2)  ", "Times New Roman Italic", 20);

// Set the center of the plot region at (350, 240), and set width x depth x height to 360 x 360 x
// 270 pixels
c.setPlotRegion(350, 240, 360, 360, 270);

// Set the elevation and rotation angles to 15 and 30 degrees
c.setViewAngle(15, 30);

// Add a scatter group to the chart using 13 pixels glass sphere symbols, in which the color depends
// on the z value of the symbol
ThreeDScatterGroup g = c.addScatterGroup(xData, yData, zData, "", Chart.GlassSphere2Shape, 13,
    Chart.SameAsMainColor);

// Add grey (888888) drop lines to the symbols
g.setDropLine(0x888888);

// Add a color axis (the legend) in which the left center is anchored at (645, 220). Set the length
// to 200 pixels and the labels on the right side. Use smooth gradient coloring.
c.setColorAxis(645, 220, Chart.Left, 200, Chart.Right).setColorGradient();

// Set the x, y and z axis titles using 10 points Arial Bold font
c.xAxis().setTitle("X-Axis Place Holder", "Arial Bold", 10);
c.yAxis().setTitle("Y-Axis Place Holder", "Arial Bold", 10);
c.zAxis().setTitle("Z-Axis Place Holder", "Arial Bold", 10);

// Output the chart
WebChartViewer viewer = new WebChartViewer(request, "chart1");
viewer.setChart(c, Chart.SVG);

// Include tool tip for the chart
viewer.setImageMap(c.getHTMLImageMap("", "", "title='&lt;*cdml*&gt;x={x|p}, y={y|p}, z={z|p}'"));
%&gt;
&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;3D Scatter Chart (2)&lt;/title&gt;
    &lt;!-- Include ChartDirector Javascript Library to support chart interactions --&gt;
    &lt;script type="text/javascript" src="cdjcv.js"&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body style="margin:5px 0px 0px 5px"&gt;
    &lt;div style="font:bold 18pt verdana;"&gt;
        3D Scatter Chart (2)
    &lt;/div&gt;
    &lt;hr style="border:solid 1px #000080; background:#000080" /&gt;
    &lt;div style="font:10pt verdana; margin-bottom:1.5em"&gt;
        &lt;a href="viewsource.jsp?file=&lt;%=request.getServletPath()%&gt;"&gt;View Source Code&lt;/a&gt;
    &lt;/div&gt;
    &lt;!-- ****** Here is the chart image ****** --&gt;
    &lt;%= viewer.renderHTML(response) %&gt;
&lt;/body&gt;
&lt;/html&gt;</code></div>
</div>
<br><hr class="separator"><div class="copyright">&copy; 2022 Advanced Software Engineering Limited. All rights reserved.</div>
</body>
</HTML>
